package com.gcosc.hly.codejava.result;


import com.gcosc.hly.codejava.exception.BusinessException;
import com.gcosc.hly.codejava.exception.TokenAuthExpiredException;

public class Code {
    public static final Integer OK = 200;

    public static final Integer TOKEN_AUTH_ERR = 402;// 权限
    public static final Integer TOKEN_ERR = 403;// token异常

    public static final Integer BUSINESS_ERR = 501;// 业务异常
    public static final Integer PARAMS_ERR = 502;// 参数异常
    public static final Integer SYSTEM_ERR = 601;// 系统异常
    public static final Integer SYSTEM_TIMEOUT_ERR = 602;// 系统超时异常
    public static final Integer SYSTEM_UNKNOWN_ERR = 699;// 系统未知异常

    public static void TOKEN_ERR(String msg){
        throw new BusinessException(Code.TOKEN_ERR, msg);
    }

    public static void PARAMS_ERR(String msg){
        throw new BusinessException(Code.PARAMS_ERR, msg);
    }

    public static void TOKEN_AUTH_ERR(){
        throw new TokenAuthExpiredException();
    }

    public static void BUSINESS_ERR(String msg){
        throw new BusinessException(Code.BUSINESS_ERR, msg);
    }

    public static void SYSTEM_ERR(String msg){
        throw new BusinessException(Code.SYSTEM_ERR, msg);
    }
}